package com.campus.secondhand.common.constant;

/**
 * ElasticSearch索引常量
 */
public class IndexConstants {

    /**
     * 商品索引名
     */
    public static final String PRODUCT_INDEX = "products";

    /**
     * 学校索引名
     */
    public static final String SCHOOL_INDEX = "schools";

    /**
     * 用户索引名
     */
    public static final String USER_INDEX = "users";

    /**
     * 商品索引映射
     */
    public static final String PRODUCT_MAPPING = "{\n" +
            "  \"mappings\": {\n" +
            "    \"properties\": {\n" +
            "      \"id\": { \"type\": \"long\" },\n" +
            "      \"name\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"price\": { \"type\": \"scaled_float\", \"scaling_factor\": 100 },\n" +
            "      \"originalPrice\": { \"type\": \"scaled_float\", \"scaling_factor\": 100 },\n" +
            "      \"description\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"condition\": { \"type\": \"keyword\" },\n" +
            "      \"sellerId\": { \"type\": \"long\" },\n" +
            "      \"sellerName\": { \"type\": \"keyword\" },\n" +
            "      \"sellerAvatar\": { \"type\": \"keyword\" },\n" +
            "      \"schoolId\": { \"type\": \"long\" },\n" +
            "      \"schoolName\": { \"type\": \"keyword\" },\n" +
            "      \"categoryId\": { \"type\": \"long\" },\n" +
            "      \"categoryName\": { \"type\": \"keyword\" },\n" +
            "      \"longitude\": { \"type\": \"geo_point\" },\n" +
            "      \"latitude\": { \"type\": \"geo_point\" },\n" +
            "      \"views\": { \"type\": \"integer\" },\n" +
            "      \"favorites\": { \"type\": \"integer\" },\n" +
            "      \"status\": { \"type\": \"integer\" },\n" +
            "      \"badge\": { \"type\": \"keyword\" },\n" +
            "      \"mainImage\": { \"type\": \"keyword\" },\n" +
            "      \"images\": { \"type\": \"keyword\" },\n" +
            "      \"createdAt\": { \"type\": \"date\" },\n" +
            "      \"updatedAt\": { \"type\": \"date\" }\n" +
            "    }\n" +
            "  }\n" +
            "}";

    /**
     * 学校索引映射
     */
    public static final String SCHOOL_MAPPING = "{\n" +
            "  \"mappings\": {\n" +
            "    \"properties\": {\n" +
            "      \"id\": { \"type\": \"long\" },\n" +
            "      \"name\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"location\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"provinceId\": { \"type\": \"integer\" },\n" +
            "      \"province\": { \"type\": \"keyword\" },\n" +
            "      \"cityId\": { \"type\": \"integer\" },\n" +
            "      \"city\": { \"type\": \"keyword\" },\n" +
            "      \"logo\": { \"type\": \"keyword\" },\n" +
            "      \"status\": { \"type\": \"integer\" }\n" +
            "    }\n" +
            "  }\n" +
            "}";

    /**
     * 用户索引映射
     */
    public static final String USER_MAPPING = "{\n" +
            "  \"mappings\": {\n" +
            "    \"properties\": {\n" +
            "      \"id\": { \"type\": \"long\" },\n" +
            "      \"username\": { \"type\": \"keyword\" },\n" +
            "      \"nickname\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"avatar\": { \"type\": \"keyword\" },\n" +
            "      \"schoolId\": { \"type\": \"long\" },\n" +
            "      \"schoolName\": { \"type\": \"keyword\" },\n" +
            "      \"introduction\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"region\": { \"type\": \"text\", \"analyzer\": \"ik_max_word\", \"search_analyzer\": \"ik_smart\" },\n"
            +
            "      \"rating\": { \"type\": \"float\" },\n" +
            "      \"registerTime\": { \"type\": \"date\" },\n" +
            "      \"status\": { \"type\": \"integer\" }\n" +
            "    }\n" +
            "  }\n" +
            "}";
}